package org.cn.cf.db;

import java.sql.Connection;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


public class ConnectBean implements java.io.Serializable{
	private static final Log LOG = LogFactory.getLog(ConnectBean.class);
	private int index;
	private long iStartUsing;
	private Connection con = null;
	private boolean bUse;
	private boolean bfault;
	
	
	
	public ConnectBean(int poolIndex,Connection con){
		index = poolIndex;
		iStartUsing = -1;
		bUse = false;
		bfault = false;
		this.con = con;
	}
	public boolean equels(Object object){
		boolean eTrue = false;
		try{
			ConnectBean conBean = (ConnectBean)object;
		    eTrue = conBean.getIndex()==index;
		}catch(Exception e){
			//e.printStackTrace();
			LOG.error(e.getMessage());
		}
		return eTrue;
	}
	public void releaseCon(){
		try{
			if(con!=null) con.close();
		}catch(Exception e){
			//e.printStackTrace();
			LOG.error(e.getMessage());
		}
		bfault = false;
	}
	
	public boolean isBUse() {
		return bUse;
	}
	public void setBUse(boolean use) {
		bUse = use;
	}
	public Connection getCon() {
		return con;
	}
	public void setCon(Connection con) {
		this.con = con;
	}
	public int getIndex() {
		return index;
	}
	public void setIndex(int index) {
		this.index = index;
	}
	public long getIStartUsing() {
		return iStartUsing;
	}
	public void setIStartUsing(long startUsing) {
		iStartUsing = startUsing;
	}
	public boolean isBfault() {
		return bfault;
	}
	public void setBfault(boolean bfault) {
		this.bfault = bfault;
	}

}
